cmake_minimum_required(VERSION 3.18)
project(JsonCppExample LANGUAGES CXX)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 11)

# 添加自定义模块路径
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# 查找 JsonCpp 库 (Module 模式)
# find_package(JsonCpp REQUIRED MODULE)
find_package(jsoncpp CONFIG REQUIRED)


# 打印查找结构
message(STATUS "JsonCpp_FOUND: ${JsonCpp_FOUND}")
message(STATUS "JsonCpp_INCLUDE_DIRS: ${JsonCpp_INCLUDE_DIRS}")
message(STATUS "JsonCpp_LIBRARIES: ${JsonCpp_LIBRARIES}")

# 添加可执行文件
add_executable(myapp src/main.cpp)

# 链接 JsonCpp 库
target_link_libraries(myapp PRIVATE JsonCpp::JsonCpp)

